#include <STC89C5xRC.H>
#include "Dri_UART_MultiByte.h"
#include "Com_Util.h"
#include "Dri_PackageTimer0.h"
#include <STRING.H>


void PollingProcessData();

void main()
{
    Dri_PackageTimer0_Init();
    Dri_UART_MultiByte_Init();
    while (1)
    {
        PollingProcessData();
    }
}

void PollingProcessData()
{
    char str[16];
    bit isReciverd=Dri_UART_MultiByteReceiveStr(str);
    if (isReciverd==0)
    {
        return;
    }
    if (strcmp(str,"on")==0) 
    {
        P0 = 0x00;
        Dri_UART_MultiByte_SendString("OK:LED is On");
    } 
    else if (strcmp(str,"off")==0) 
    {
        P0 = 0xff;
        Dri_UART_MultiByte_SendString("OK:LED is Off");
    }else
    {
        Dri_UART_MultiByte_SendString("Error:Unknown Command\r\n");
    }
}